#include<bits/stdc++.h>
using namespace std;
int n;
const int MAXN=114514;
int r[MAXN],cnt[MAXN];
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.sync_with_stdio(0);
	cout.sync_with_stdio(0);
	cin>>n;
	int ans=0,maxcnt=-1;
	for(int i=1;i<=n;i++){
		cin>>r[i];
		cnt[r[i]]++;
		maxcnt=max(maxcnt,cnt[r[i]]);
	}
	for(int i=1;i<=maxcnt;i++){
		if(maxcnt>=i)ans++;
	}
	cout<<ans<<endl;
	return 0;
}
	
